﻿using System.Collections.Generic;
using System.Linq;
using Wen.Core;
using Snoop;

namespace Wen.UI
{
	public static class ProcessHelpers
	{
		private static readonly string[] ProcessNamesToIgnore = new[] { "devenv", "Idle" };
		public static IList<WindowInfo> GetRunningWpfWindows() {
			return NativeMethods.ToplevelWindows.Select(ptr => new WindowInfo(ptr)).Where(wi => wi.IsValidProcess && !ProcessNamesToIgnore.Any(wi.OwningProcess.ProcessName.Contains)).DistinctBy(wi => wi.OwningProcess.Id).ToList();
		}
	}
}
